<?php
class Director {

	//需完善,各种策略. 确认session与cookie的各种机制及存放内容
	/**
	 * @param String $relier		
	 * @param String $type			none,session,cookie,cache and so on
	 * @param String $op			Set,Get,Clear,Delete,Change and so on
	 * @param String $receive		Obj,Array,None
	 */
	static public function Instance( $relier, $type = 'Session', $op = 'Set', $receive = 'None' ) {
		static $object = array() ;
		//根据策略  对用户进行不同操作 , 返回用户信息数组
		$available = array( 
			'Session' , 
			'Cookie' 
		) ;
		if ( in_array( $type, $available ) ) {
			if ( !isset( $object[$type] ) ) {
				$className = 'in' . $type ;
				$object[$type] = new $className() ;
			}
			if ( $receive == 'Array' ) {
				$userClaseName = APP_USER_MODEL.'User';
				$relier = new $userClaseName( $relier ) ;
			}
		}
		return $object[$type]->{'_' . strtolower( $op )}( $relier ) ;
	}
}

abstract class inDirector {

	abstract public function _set( $relier = null ) ;

	abstract public function _get( $relier = null ) ;

	abstract public function _clear( $relier = null ) ;

	abstract public function _delete( $relier = null ) ;
	
}